package com.niiwoo.civet.account.service.local.refund;

import com.niiwoo.civet.account.dao.mapper.ProTransactionOrderMapperExt;
import com.niiwoo.civet.account.service.local.refund.newRefund.AccountRefundProcessAutoLocalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by dell on 2018/4/2.
 */
@Service
@Slf4j
public class CommonToolsService {
    @Autowired
    private ProTransactionOrderMapperExt proTransactionOrderMapperExt;
    @Autowired
    private AccountRefundProcessAutoLocalService accountRefundProcessAutoLocalService;

    public void rollBackForGuaranteeAccount(){
        List<Long> proOrderIds = proTransactionOrderMapperExt.rollBackGuaranteeMoney();
        if (proOrderIds!=null){
            log.info("proOrderIds数据size={}",proOrderIds);
            for (Long proOrderId : proOrderIds) {
                log.info("解冻订单号proOrderId={}",proOrderId);
                accountRefundProcessAutoLocalService.rollbackProTransaction(proOrderId);
                log.info("解冻订单号proOrderId={},end",proOrderId);
            }
        }else {
            log.info("查无数据");
        }
    }
}
